package com.wt.admin.service.chart.impl;

import cn.hutool.core.bean.BeanUtil;
import com.aizuda.easy.security.domain.Rep;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wt.admin.code.chat.Chat4000;
import com.wt.admin.domain.dto.chat.ChatModelDTO;
import com.wt.admin.domain.entity.chat.ChatModelEntity;
import com.wt.admin.domain.vo.chart.ChatModelVO;
import com.wt.admin.mapper.chat.ChatModelMapper;
import com.wt.admin.service.chart.ChatModelService;
import com.wt.admin.util.AssertUtil;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class ChatModelServiceImpl extends ServiceImpl<ChatModelMapper, ChatModelEntity> implements ChatModelService {

    @Resource
    private ChatModelMapper chatModelMapper;

    @Override
    public ChatModelVO modelEdit(ChatModelDTO data) {
        AssertUtil.Str.isEmpty(data.getChatName(), Chat4000.CODE_4000);
        AssertUtil.objIsNull(data.getLanguageClassificationId(), Chat4000.CODE_4002);
        AssertUtil.Str.isEmpty(data.getChatDesc(),Chat4000.CODE_4001);
        saveOrUpdate(data);
        return BeanUtil.copyProperties(data,ChatModelVO.class);
    }

    @Override
    public List<ChatModelVO> modeList(ChatModelDTO data) {
        return chatModelMapper.modeList(data);
    }

    @Override
    public void delById(ChatModelDTO data) {
        chatModelMapper.deleteById(data.getId());
    }

    @Override
    public ChatModelEntity findById(Integer integer) {
        return chatModelMapper.selectById(integer);
    }

}
